package com.applcn.user.constant;

import com.baomidou.mybatisplus.core.enums.IEnum;

/**
 * com.applcn.user.constant
 * Description:
 *
 * @author: 大妖怪
 * @date: 2020-03-09 00:02
 */
public enum MenuTypeEnum implements IEnum<Integer> {

    /**
     * 目录
     */
    CATALOG(1, "目录"),

    /**
     * 菜单
     */
    MENU(2, "菜单"),

    /**
     * 按钮
     */
    BUTTON(3, "按钮");

    private int code;

    private String desc;

    public int getCode() {
        return code;
    }

    public String getDesc() {
        return desc;
    }

    public static MenuTypeEnum checkCode(Integer code) {
        for (MenuTypeEnum menuTypeEnum : MenuTypeEnum.values()) {
            if (menuTypeEnum.getCode() == code) {
                return menuTypeEnum;
            }
        }
        return null;
    }

    MenuTypeEnum(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.getCode();
    }
}
